home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
glass
/
glass.lha
/
GLASS
/
uflat2
/
test15.gl
< prev
next >
Wrap
Text File
|
1991-06-18
|
520b
|
26 lines
Basetype E;
Atom
not :- E => E,
nand2 :- E & E => E,
and3 :- E & E & E => E,
or4 :- E & E & E & E => E,
and2 :- E & E => E,
or3 :- E & E & E => E,
adc :- E & E & E => E & E;
Mac
adder :- Int -: n -> E & E^n & E^n => E^n & E;
adder 0 [c, [],[]] = [[], c];
adder n [c, a:as, b:bs] = [s:ss, cout]
where
[s,v] = adc [a,b,c];
[ss, cout] = adder (n-1) [v, as, bs];
endwhere;
Def
adder4 :- E & E^4 & E^4 => E^4 & E;
adder4 [c, as,bs] = adder 4 [c, as,bs];